﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void Form2_Load(object sender, EventArgs e)
        {

        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            if(batNgoaiLe())
            {
                String ten = txtTen.Text;
                String matkhau = txtMatKhau.Text;
                if(ten.Equals("Chien")&&matkhau.Equals("123"))
                {
                    MessageBox.Show("Dang Nhap Thanh Cong");
                }
                else
                {
                    MessageBox.Show("Dang Nhap That Bai");
                }
            }
        }
        public Boolean batNgoaiLe()
        {
            int x = 0;
            if (txtTen.Text.Equals(""))
            {
                MessageBox.Show("Hay Nhap Ten Dang Nhap");
                return false;
            }
            else if(txtMatKhau.Text.Equals(""))
            {
                MessageBox.Show("Hay Nhap Ten Mat Khau");
                return false;
            }
            return true;
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult=MessageBox.Show("Ban co muon thoat khong","",MessageBoxButtons.YesNo);
            if (dialogResult == DialogResult.Yes)
            {
                this.Close();
            }
            else if (dialogResult == DialogResult.No)
            {
               
            }
            
        }

        private void groupBox1_Enter(object sender, EventArgs e)
        {

        }
    }
}
